package com.qin.mall.openfeign.product;

import com.qin.mall.common.api.CommonResult;
import com.qin.mall.common.api.MyBatisPlusPage;
import com.qin.mall.domain.PmsProduct;
import com.qin.mall.dto.PmsProductParam;
import com.qin.mall.dto.PmsProductQueryParam;
import com.qin.mall.dto.PmsProductResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 产品管理
 * @author Leisure
 * create 2022 2022/11/19 10:39
 **/
@FeignClient("product-manage")
public interface ProductFeigin {

    //创建商品
    @PostMapping("product/create$")
    public CommonResult create(@RequestBody PmsProductParam productParam);

    //查询商品信息不关联其他信息
    @GetMapping("product/select$")
    public Object select(@RequestParam("id") Long id);

    //根据商品编号获取更新前的信息,和其他关联的所有的信息
    @GetMapping("product/updateInfo$/{id}")
    public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id);

    //更新商品
    @PostMapping("product/update$/")
    public CommonResult updateById(@RequestParam("id") Long id,
                             @RequestBody PmsProductParam productParam);

    //分页查询商品
    @PostMapping("product/list$")
    public CommonResult<MyBatisPlusPage<PmsProduct>> getListAll(
            @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
            @RequestParam(value = "pageSize",defaultValue = "5") Integer pageSiz,
            @RequestBody PmsProductQueryParam productQueryParam);

    //批量修改审核状态
    @PostMapping("product/update/verifyStatus$")
    public CommonResult updateStatus(@RequestParam("verifyStatus") Integer verifyStatus,
                               @RequestParam("detail") String detail,
                               @RequestBody List<Long> ids);

    //批量修改商品上下架状态
    @PostMapping("product/update/publishStatus$")
    @ResponseBody
    public CommonResult updatepublishStatus(@RequestParam("publishStatus") Integer publishStatus,
                                            @RequestParam("ids") List<Long> ids);

    //批量修改商品推荐状态
    @PostMapping("product/update/recommendStatus$")
    @ResponseBody
    public CommonResult updateRecommendStatus(@RequestParam("recommendStatus") Integer recommendStatus,
                                              @RequestParam("ids") List<Long> ids);

    //批量修改新品状态
    @PostMapping("product/update/newStatus$")
    public CommonResult updateNewStatus(@RequestParam("newStatus") Integer newStatus,
                                        @RequestParam("ids") List<Long> ids);

    //批量删除商品
    @PostMapping("product/update/deleteStatus$")
    @ResponseBody
    public CommonResult updateDeleteStatus(@RequestParam("deleteStatus") Integer deleteStatus,
                                           @RequestParam("ids") List<Long> ids);

    //根据商品名称或者货号模糊查询
    @GetMapping("product/simpleList$")
    public CommonResult<List<PmsProduct>> getList(@RequestParam("keyword") String keyword);
    
    
    
}
